/*
 * @Author: your name
 * @Date: 2020-05-13 23:37:56
 * @LastEditTime: 2020-05-13 23:48:47
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \ts\ts_test\function.js
 */
/**
 * 函数声明的写法
 * @param x
 * @param y
 * @param z
 */
 function add(x:number,y:number,z?:number) : number {
   if(typeof z === 'number'){
     return x + y + z
   }
   return x + y
 }
 let result:number = add(2,5)
 let result2:number = add(2,5,8)

 /**
  * 函数表达式
  */
  let addfn =(x:number,y:number,z?:number) : number => {
    if(typeof z === 'number'){
      return x + y + z
    }
    return x + y
  }

  let addfn3:(x:number,y:number,z?:number)=>number = addfn
